/**
 * this class is the top framework class. it mocked some java package like thing to overcome
 * naming conflict on complex web project
 * @author maoanapex88@163.com Mao Anping
 */
var log = console.log || {};

if(typeof String.prototype.trim !== 'function') {
	String.prototype.trim = function() {
	  var str = this,
	  str = str.replace(/^\s\s*/, ''),
	  ws = /\s/,
	  i = str.length;
	  while (ws.test(str.charAt(--i)));
	  return str.slice(0, i + 1);
	}
}
if(typeof String.prototype.ltrim !== 'function') {
	String.prototype.ltrim = function() {
		return this.replace(/(^\s*)/g,"");
	}
}
if(typeof String.prototype.rtrim !== 'function') {
	String.prototype.rtrim = function() {
		return this.replace(/(\s*$)/g,""); 
	}
}
if(typeof String.prototype.replaceAll !== 'function') {
	String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase) { 
		if (!RegExp.prototype.isPrototypeOf(reallyDo)) { 
			return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi": "g")), replaceWith); 
		} else { 
			return this.replace(reallyDo, replaceWith); 
		} 
	} 
}
if(typeof Date.prototype.hhmmaa !== 'function') {
	Date.prototype.hhmmaa = function() {
		var hh=this.getHours();
		var mm=this.getMinutes();
		var ss=this.getSeconds();
		var suf=' AM';
		if(hh>=12) suf=' PM';
		hh%=12;
		return '['+(hh<10?'0':'')+hh+':'+(mm<10?'0':'')+mm+':'+(ss<10?'0':'')+ss+suf+']';
	}
}
if(console.log){
	console.log('Console detected');
}
var jweb = window.jweb || {
	version : '1.0-SNAPSHOT'
};
window["undefined"] = window["undefined"];/*old version of browser*/
jweb.namespace = function(ns) {
	if (!ns || !ns.length) {
		return null;
	}
	var levels = ns.split(".");
	var nsobj = jweb;
	for ( var i = (levels[0] == "jweb") ? 1 : 0; i < levels.length; ++i) {
		nsobj[levels[i]] = nsobj[levels[i]] || {};
		nsobj = nsobj[levels[i]];
	}
	return nsobj;
};
//the extended name space
jweb.namespace("jweb.gdgsuzhou.webmusic");
jweb.namespace("jweb.util");